/**
 * 数据转换
 * @author xiufu.wang
 */
import formatDatafield from './format-datafield'
import formatGroup from './format-group'
import formatFieldmap from './format-fieldmap'
import formatArraytree from './format-arraytree'
/**
 * 执行顺序如下:
 * formatDatafield: 提取数据
 * formatArraytree 数组转树
 * formatFieldmap 字段转换
 * 以下是具体的业务逻辑
 * formatGroup 分组
 */
const formats = [formatDatafield, formatArraytree, formatFieldmap, formatGroup]

export default function (datas, opt, dataSource) { 
    return formats.reduce((m, t) => t(m, opt, dataSource), datas)
}